Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / core / service / src / commonTest / kotlin / org / meshtastic / core / service / ServiceRepositoryImplTest.kt

Displaying Raw • Download

core/service/src/commonTest/kotlin/org/meshtastic/core/service/ServiceRepositoryImplTest.kt renovate/net.java.dev.jna-jna-5.x (5a8f4966) Text, 4.43 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.service

Tff7b72import T7ee787co.touchlab.kermit.Severity
Tff7b72import T7ee787kotlinx.coroutines.ExperimentalCoroutinesApi
Tff7b72import T7ee787kotlinx.coroutines.async
Tff7b72import T7ee787kotlinx.coroutines.flow.drop
Tff7b72import T7ee787kotlinx.coroutines.flow.first
Tff7b72import T7ee787kotlinx.coroutines.test.advanceTimeBy
Tff7b72import T7ee787kotlinx.coroutines.test.runCurrent
Tff7b72import T7ee787kotlinx.coroutines.test.runTest
Tff7b72import T7ee787kotlinx.coroutines.withTimeoutOrNull
Tff7b72import T7ee787org.meshtastic.core.model.ConnectionState
Tff7b72import T7ee787org.meshtastic.core.model.service.ServiceAction
Tff7b72import T7ee787org.meshtastic.core.model.service.TracerouteResponse
Tff7b72import T7ee787kotlin.test.Test
Tff7b72import T7ee787kotlin.test.assertEquals
Tff7b72import T7ee787kotlin.test.assertNull

Tf0883e@OptInTb4b4b4(Te6edf3ExperimentalCoroutinesApiTff7b72::Te6edf3classTb4b4b4)
Tff7b72class T56d364ServiceRepositoryImplTest Tb4b4b4{

Tf0883e@Test
Tff7b72fun Td2a8ffinitialStateExposesDefaultsAndNoBufferedEventsTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runTest Tb4b4b4{
Tff7b72val Te6edf3repository Tff7b72= Te6edf3ServiceRepositoryImplTb4b4b4(Tb4b4b4)

Te6edf3assertEqualsTb4b4b4(Te6edf3ConnectionStateTb4b4b4.Te6edf3DisconnectedTb4b4b4, Te6edf3repositoryTb4b4b4.Te6edf3connectionStateTb4b4b4.Te6edf3valueTb4b4b4)
Te6edf3assertNullTb4b4b4(Te6edf3repositoryTb4b4b4.Te6edf3clientNotificationTb4b4b4.Te6edf3valueTb4b4b4)
Te6edf3assertNullTb4b4b4(Te6edf3repositoryTb4b4b4.Te6edf3errorMessageTb4b4b4.Te6edf3valueTb4b4b4)
Te6edf3assertNullTb4b4b4(Te6edf3repositoryTb4b4b4.Te6edf3connectionProgressTb4b4b4.Te6edf3valueTb4b4b4)
Te6edf3assertNullTb4b4b4(Te6edf3repositoryTb4b4b4.Te6edf3tracerouteResponseTb4b4b4.Te6edf3valueTb4b4b4)
Te6edf3assertNullTb4b4b4(Te6edf3repositoryTb4b4b4.Te6edf3neighborInfoResponseTb4b4b4.Te6edf3valueTb4b4b4)

Tff7b72val Te6edf3initialMeshPacket Tff7b72= Te6edf3async Tb4b4b4{ Te6edf3withTimeoutOrNullTb4b4b4(T79c0ff1Tb4b4b4) Tb4b4b4{ Te6edf3repositoryTb4b4b4.Te6edf3meshPacketFlowTb4b4b4.Te6edf3firstTb4b4b4(Tb4b4b4) Tb4b4b4} Tb4b4b4}
Tff7b72val Te6edf3initialServiceAction Tff7b72= Te6edf3async Tb4b4b4{ Te6edf3withTimeoutOrNullTb4b4b4(T79c0ff1Tb4b4b4) Tb4b4b4{ Te6edf3repositoryTb4b4b4.Te6edf3serviceActionTb4b4b4.Te6edf3firstTb4b4b4(Tb4b4b4) Tb4b4b4} Tb4b4b4}

Te6edf3runCurrentTb4b4b4(Tb4b4b4)
Te6edf3advanceTimeByTb4b4b4(T79c0ff1Tb4b4b4)

Te6edf3assertNullTb4b4b4(Te6edf3initialMeshPacketTb4b4b4.Te6edf3awaitTb4b4b4(Tb4b4b4)Tb4b4b4)
Te6edf3assertNullTb4b4b4(Te6edf3initialServiceActionTb4b4b4.Te6edf3awaitTb4b4b4(Tb4b4b4)Tb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8ffsetConnectionStateUpdatesStateFlowTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runTest Tb4b4b4{
Tff7b72val Te6edf3repository Tff7b72= Te6edf3ServiceRepositoryImplTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3emittedState Tff7b72= Te6edf3async Tb4b4b4{ Te6edf3repositoryTb4b4b4.Te6edf3connectionStateTb4b4b4.Te6edf3dropTb4b4b4(T79c0ff1Tb4b4b4)Tb4b4b4.Te6edf3firstTb4b4b4(Tb4b4b4) Tb4b4b4}

Te6edf3runCurrentTb4b4b4(Tb4b4b4)
Te6edf3repositoryTb4b4b4.Te6edf3setConnectionStateTb4b4b4(Te6edf3ConnectionStateTb4b4b4.Te6edf3ConnectingTb4b4b4)

Te6edf3assertEqualsTb4b4b4(Te6edf3ConnectionStateTb4b4b4.Te6edf3ConnectingTb4b4b4, Te6edf3emittedStateTb4b4b4.Te6edf3awaitTb4b4b4(Tb4b4b4)Tb4b4b4)
Te6edf3assertEqualsTb4b4b4(Te6edf3ConnectionStateTb4b4b4.Te6edf3ConnectingTb4b4b4, Te6edf3repositoryTb4b4b4.Te6edf3connectionStateTb4b4b4.Te6edf3valueTb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8ffonServiceActionEmitsThroughFlowTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runTest Tb4b4b4{
Tff7b72val Te6edf3repository Tff7b72= Te6edf3ServiceRepositoryImplTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3action Tff7b72= Te6edf3ServiceActionTb4b4b4.Te6edf3GetDeviceMetadataTb4b4b4(Te6edf3destNum Tff7b72= T79c0ff4T79c0ff2Tb4b4b4)
Tff7b72val Te6edf3emittedAction Tff7b72= Te6edf3async Tb4b4b4{ Te6edf3repositoryTb4b4b4.Te6edf3serviceActionTb4b4b4.Te6edf3firstTb4b4b4(Tb4b4b4) Tb4b4b4}

Te6edf3runCurrentTb4b4b4(Tb4b4b4)
Te6edf3repositoryTb4b4b4.Te6edf3onServiceActionTb4b4b4(Te6edf3actionTb4b4b4)

Te6edf3assertEqualsTb4b4b4(Te6edf3actionTb4b4b4, Te6edf3emittedActionTb4b4b4.Te6edf3awaitTb4b4b4(Tb4b4b4)Tb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8ffsetErrorMessageEmitsAndCanBeClearedTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runTest Tb4b4b4{
Tff7b72val Te6edf3repository Tff7b72= Te6edf3ServiceRepositoryImplTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3emittedMessage Tff7b72= Te6edf3async Tb4b4b4{ Te6edf3repositoryTb4b4b4.Te6edf3errorMessageTb4b4b4.Te6edf3dropTb4b4b4(T79c0ff1Tb4b4b4)Tb4b4b4.Te6edf3firstTb4b4b4(Tb4b4b4) Tb4b4b4}

Te6edf3runCurrentTb4b4b4(Tb4b4b4)
Te6edf3repositoryTb4b4b4.Te6edf3setErrorMessageTb4b4b4(Ta5d6ff"Ta5d6ffBLE connection lostTa5d6ff"Tb4b4b4, Te6edf3SeverityTb4b4b4.Te6edf3WarnTb4b4b4)

Te6edf3assertEqualsTb4b4b4(Ta5d6ff"Ta5d6ffBLE connection lostTa5d6ff"Tb4b4b4, Te6edf3emittedMessageTb4b4b4.Te6edf3awaitTb4b4b4(Tb4b4b4)Tb4b4b4)
Te6edf3assertEqualsTb4b4b4(Ta5d6ff"Ta5d6ffBLE connection lostTa5d6ff"Tb4b4b4, Te6edf3repositoryTb4b4b4.Te6edf3errorMessageTb4b4b4.Te6edf3valueTb4b4b4)

Te6edf3repositoryTb4b4b4.Te6edf3clearErrorMessageTb4b4b4(Tb4b4b4)

Te6edf3assertNullTb4b4b4(Te6edf3repositoryTb4b4b4.Te6edf3errorMessageTb4b4b4.Te6edf3valueTb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8ffsetTracerouteResponseEmitsAndCanBeClearedTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runTest Tb4b4b4{
Tff7b72val Te6edf3repository Tff7b72= Te6edf3ServiceRepositoryImplTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3response Tff7b72=
Te6edf3TracerouteResponseTb4b4b4(
Te6edf3message Tff7b72= Ta5d6ff"Ta5d6ffTraceroute completeTa5d6ff"Tb4b4b4,
Te6edf3destinationNodeNum Tff7b72= T79c0ff1T79c0ff2T79c0ff3Tb4b4b4,
Te6edf3requestId Tff7b72= T79c0ff4T79c0ff5T79c0ff6Tb4b4b4,
Te6edf3forwardRoute Tff7b72= Te6edf3listOfTb4b4b4(T79c0ff1Tb4b4b4, T79c0ff2Tb4b4b4, T79c0ff3Tb4b4b4)Tb4b4b4,
Te6edf3returnRoute Tff7b72= Te6edf3listOfTb4b4b4(T79c0ff3Tb4b4b4, T79c0ff2Tb4b4b4, T79c0ff1Tb4b4b4)Tb4b4b4,
Tb4b4b4)
Tff7b72val Te6edf3emittedResponse Tff7b72= Te6edf3async Tb4b4b4{ Te6edf3repositoryTb4b4b4.Te6edf3tracerouteResponseTb4b4b4.Te6edf3dropTb4b4b4(T79c0ff1Tb4b4b4)Tb4b4b4.Te6edf3firstTb4b4b4(Tb4b4b4) Tb4b4b4}

Te6edf3runCurrentTb4b4b4(Tb4b4b4)
Te6edf3repositoryTb4b4b4.Te6edf3setTracerouteResponseTb4b4b4(Te6edf3responseTb4b4b4)

Te6edf3assertEqualsTb4b4b4(Te6edf3responseTb4b4b4, Te6edf3emittedResponseTb4b4b4.Te6edf3awaitTb4b4b4(Tb4b4b4)Tb4b4b4)
Te6edf3assertEqualsTb4b4b4(Te6edf3responseTb4b4b4, Te6edf3repositoryTb4b4b4.Te6edf3tracerouteResponseTb4b4b4.Te6edf3valueTb4b4b4)

Te6edf3repositoryTb4b4b4.Te6edf3clearTracerouteResponseTb4b4b4(Tb4b4b4)

Te6edf3assertNullTb4b4b4(Te6edf3repositoryTb4b4b4.Te6edf3tracerouteResponseTb4b4b4.Te6edf3valueTb4b4b4)
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.05s